class ClientcategoriesController < ApplicationController
  layout "application" 
  # GET /clientcategories
  # GET /clientcategories.xml
  def index
    @clientcategories = Clientcategory.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @clientcategories }
    end
  end

  # GET /clientcategories/1
  # GET /clientcategories/1.xml
  def show
    @clientcategory = Clientcategory.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @clientcategory }
    end
  end

  # GET /clientcategories/new
  # GET /clientcategories/new.xml
  def new
    @clientcategory = Clientcategory.new(params[:clientcategory])
    if request.post? and @clientcategory.save
      flash[:notice] = "Client category #{@clientcategory.name} has been created..."
      @clientcategory = Clientcategory.new
    end
  end

  # GET /clientcategories/1/edit
  def edit
    @clientcategory = Clientcategory.find(params[:id])
  end

  # POST /clientcategories
  # POST /clientcategories.xml
  def create
    @clientcategory = Clientcategory.new(params[:clientcategory])

    respond_to do |format|
      if @clientcategory.save
        flash[:notice] = 'Clientcategory was successfully created.'
        format.html { redirect_to(@clientcategory) }
        format.xml  { render :xml => @clientcategory, :status => :created, :location => @clientcategory }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @clientcategory.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /clientcategories/1
  # PUT /clientcategories/1.xml
  def update
    @clientcategory = Clientcategory.find(params[:id])

    respond_to do |format|
      if @clientcategory.update_attributes(params[:clientcategory])
        flash[:notice] = 'Clientcategory was successfully updated.'
        format.html { redirect_to(@clientcategory) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @clientcategory.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /clientcategories/1
  # DELETE /clientcategories/1.xml
  def delete
    @clientcategory = Clientcategory.find(params[:id])
    @clientcategory.destroy

    respond_to do |format|
      format.html { redirect_to(clientcategories_url) }
      format.xml  { head :ok }
    end
  end
end
